<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
<link rel="stylesheet" href="/Public/css/reset.css">
<link rel="stylesheet" href="/Public/css/index.css">
<link rel="stylesheet" href="/Public/css/art.css">
</head>
<body>
    <header>
        <h1><a href="<?php echo U('home/index/index');?>">My Blog</a></h1>
        <h4>所有的伟大，源于一个勇敢的开始.</h4>
    </header>
    <nav> 
        <ul>
            <?php if(is_array($top)): foreach($top as $key=>$value): ?><li><a href="<?php echo U('home/index/nav',array('cat_id'=>$value['cat_id'],'catname'=>$value['catname']));?>"><?php echo ($value['catname']); ?></a></li><?php endforeach; endif; ?>
        </ul>
    </nav>
    <div id="main">
        <div id="lside">
            <article>
                <h2><a href="#"><?php echo ($data['title']); ?></a></h2>
                <div class="entry_header">
                    <time><?php echo ($data['pubtime']); ?></time>
                    &nbsp;by
                    <a href="#">Mr.z</a>&nbsp;&nbsp;
                    <a class="catlink" href="#"><?php echo ($data['cat_id']); ?></a>
                </div>
                <div class="entry_content">
                  <?php echo ($data['content']); ?>
                </div>
            </article>
            <div id="comments">
                <?php if(is_array($comment)): foreach($comment as $key=>$value): ?><ol>
                    <li>
                        <img src=<?php echo ($value['pic']); ?> alt="">
                        <cite><a href="#"><?php echo ($value['nick']); ?></a></cite>&nbsp;&nbsp;&nbsp;&nbsp;Email&nbsp;:&nbsp;<?php echo ($value['email']); ?><br>
                        <time><?php echo ($value['pubtime']); ?></time>
                    </li>
                    <li>
                        <?php echo ($value['content']); ?>
                    </li>
                </ol><?php endforeach; endif; ?>
            </div>
            <div id="respond" class="comment-respond">
                <h3>Comment</h3>
                <br><br>

                <form action="<?php echo U('home/index/comment');?>" method="post">

                <?php if(cookie_check() == 1): ?><p><h3>UserName : <?php echo (cookie('username')); ?></h3></p>
                    <p><h3>Email : <?php echo (cookie('email')); ?></h3></p> 
                    <p>
                    <textarea name="content" cols="45" rows="8" aria-required="true"></textarea>
                    </p>
                    <p><input type="hidden" name="art_id" value="<?php echo ($data['art_id']); ?>">
                    </p>
                    <p><input type="hidden" name="email" value="<?php echo (cookie('email')); ?>">
                    </p>  
                    <p><input type="hidden" name="nick" value="<?php echo (cookie('nick')); ?>">
                    </p>                  
                    <p>
                    <input type="submit" value="Post Comment">
                    </p>

                <?php else: ?>

                    <h3><a href="<?php echo U('home/user/login');?>">想评论,请登录。</a></h3><br><br><br><br><?php endif; ?>

                </form>

            </div>
        </div>
        <div id="rside">
            
            <aside>
                <form action="">
                    <input type="text" name="search" placeholder="Search...">
                </form>
            </aside>

            <aside>
                <h4>最新文章</h4>
                <ul>
                <?php if(is_array($hot)): foreach($hot as $key=>$value): ?><li><a href="<?php echo U('home/index/art',array('art_id'=>$value['art_id']));?>"><?php echo ($value['title']); ?></a>&nbsp;&nbsp;(<?php echo ($value['comm']); ?>)</li><?php endforeach; endif; ?>
                </ul>
            </aside>

            <?php if(cookie_check() == 1): ?><aside>
                <form action="">
                    <h4>只能评论哦~</h4>
                    <ul>
                    <li><a href="<?php echo U('home/user/register');?>">注册</a></li>
                    <br/>                    
                    <li><a href="<?php echo U('home/user/logout');?>">退出登录</a></li>
                    </ul>
                </form>
            </aside>            
            <?php else: ?>
            <aside>
                <form action="">
                    <h4>只能评论哦~</h4>
                    <ul>
                    <li><a href="<?php echo U('home/user/login');?>">登录</a></li>
                    <br/>
                    <li><a href="<?php echo U('home/user/register');?>">注册</a></li>
                    </ul>
                </form>
            </aside><?php endif; ?>
        </div>
    </div>
    <footer>
        Copyright &copy; 2015 · GeneratePress · WordPress
    </footer>
</body>
</html>